package com.fxu.jushuitan.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/***
 * <p>yuye</p>
 * 聚水潭订单状态
 * @author fangxu
 * @version 2023-12-18
 ***/
@AllArgsConstructor
public enum JstOrderStatus implements BaseEnum<String, String> {
    WaitPay("WaitPay", "待付款"),
    Delivering("Delivering", "发货中"),
    Merged("Merged", "被合并"),
    Question("Question", "异常"),
    Split("Split", "被拆分"),
    WaitOuterSent("WaitOuterSent", "等供销商|外仓发货"),
    WaitConfirm("WaitConfirm", "已付款待审核"),
    WaitFConfirm("WaitFConfirm", "已客审待财审"),
    Sent("Sent", "已发货"),
    Cancelled("Cancelled", "取消"),
    ;

    final String code;
    final String desc;

    @Override
    public String code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }

    public static String desc(String code) {
        JstOrderStatus ret = find(code);
        return ret == null ? null : ret.desc;
    }

    public static JstOrderStatus find(String code) {
        return code == null ? null : BaseEnum.findOne(values(), v -> v.code.equals(code));
    }
}
